<template>
  <el-container class="main_con">
    <div class="list_con">
      <div v-for="(item, i) in applist" :key="i">
        <span class="app_title">{{ item.name }}</span>
        <div class="list" v-bind:class="item.classname">
          <div class="item" v-for="(value, a) in item.list" :key="a" @click="topath(value)">
            <div class="icon_box"><i :class="value.meta.icon"></i></div>

            <div class="item_s">
              <span>{{ value.meta.title }}</span>
              <span>{{ value.meta.des }}</span>
            </div>
          </div>
        </div>
      </div>
    </div>
  </el-container>
</template>

<script>
import {mapGetters} from 'vuex';
export default {
  data() {
    return {
      list: [],
      applist: [
        {
          name: '营销引流',
          list: [],
          classname: 'one'
        },
        {
          name: '客群维护',
          list: [],
          classname: 'two'
        },
        {
          name: '工具',
          list: [],
          classname: 'three'
        }
      ]
    };
  },
  computed: {
    ...mapGetters(['permission_routes'])
  },
  mounted() {
    // var list = this.permission_routes.filter(_ => {
    //   return _.meta && _.meta.isapp;
    // });
    for (var i = 1; i < 4; i++) {
      this.applist[i - 1].list = this.permission_routes.filter(_ => {
        return _.meta && _.meta.apptype == i;
      });
    }
  },
  methods: {
    topath(item) {
      this.$router.push(item.redirect);
    }
  }
};
</script>

<style lang="scss" scoped>
.list {
  display: flex;
  flex-wrap: wrap;
  &.one {
    .item {
      box-shadow: 0px 3px 13px 0px rgba(95, 208, 71, 0.14);
      .icon_box {
        background: #5fd047;
      }
    }
  }
  &.two {
    .item {
      box-shadow: 0px 3px 13px 0px rgba(95, 208, 71, 0.14);
      .icon_box {
        background: #f69f24;
      }
    }
  }
  &.three {
    .item {
      box-shadow: 0px 3px 13px 0px rgba(95, 202, 212, 0.14);
      .icon_box {
        background: #5FCAD4;
      }
    }
  }
  .item {
    width: 260px;
    height: 66px;
    background: #FFFFFF;
    box-shadow: 0px 3px 13px 0px rgba(56, 167, 252, 0.28);
    border-radius: 33px;
    display: flex;
    align-items: center;
    margin-right: 100px;
    margin-bottom: 30px;
    cursor: pointer;
    .icon_box {
      width: 60px;
      height: 60px;
      margin: 3px 13px 3px 5px;
      border-radius: 50%;
      background: red;
      display: flex;
      align-items: center;
      justify-content: center;
      color: #ffffff;
      i {
        font-size: 30px;
      }
    }

    .item_s {
      display: flex;
      flex-direction: column;
      span:first-child {
        font-size: 16px;
      }
      span:nth-child(2) {
        font-size: 12px;
        color: #999999;
        margin-top: 10px;
      }
    }
  }
}
.app_title {
  font-size: 18px;
  color: #000000;
  font-weight: 800;
  display: block;
  padding: 20px;
}
</style>
